import { ajax } from '../lib/ajax.js';
console.log(ajax);

//#region echo请求演示

let txtEcho = document.getElementById('txtEcho');
let btnEcho = document.getElementById('btnEcho');
let divEcho = document.getElementById('divEcho');

btnEcho.addEventListener('click',()=>{
  ajax.get('/test/echo',{echo:txtEcho.value}, (data) => {
    divEcho.innerHTML = JSON.stringify(data);
  });

});

//#endregion

//#region echo请求演示
let btnJson = document.getElementById('btnJson');
let divJson = document.getElementById('divJson');
btnJson.addEventListener('click',()=>{
  ajax.post('/test/converter/json',
  {
    lid:1,
    logType:'用户登录',
    logInfo:'用户登录成功',
    lastupdate:'2019-09-01',
  },
  (data) => {
    divJson.innerHTML = JSON.stringify(data);
  }
  );
});
//#endregion